﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Fee.Mapping
{
    public class StationMapping : IEntityTypeConfiguration<Station>
    {
        public void Configure(EntityTypeBuilder<Station> builder)
        {
            builder.HasKey(_ => _.Id);
            builder.Property(_ => _.Id).ValueGeneratedOnAdd();
            builder.HasOne(_ => _.District);
            builder.Property(_ => _.Code).HasMaxLength(128);
            builder.Property(_ => _.Name).HasMaxLength(128);
            builder.Property(_ => _.Type);
            builder.Property(_ => _.Status);
            builder.Property(_ => _.IsVip).HasConversion<int>();
            builder.Property(_ => _.SyncTime);
            builder.Property(_ => _.CreateTime);
            builder.Property(_ => _.UsersNumber);
            builder.HasIndex(_ => _.Code);
            builder.HasOne(f => f.OrderDistrict);
            // builder.HasOne(f => f.ConstructionTask);
            builder.HasIndex(f => f.Code);
            builder.ToTable("fee_Station");
        }
    }
}